﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace Indie_Game_Contest
{
    public class TextureManager
    {
        private static TextureManager instance;

        //////////////////////////////////////////////////////////////////////////
        // Data Members
        List<Texture2D> textures = new List<Texture2D>();
        List<SpriteFont> spriteFonts = new List<SpriteFont>();

        //////////////////////////////////////////////////////////////////////////
        // Methods
        private TextureManager() { }
        public int AddTexture(Texture2D tex)
        {
            textures.Add(tex);
            return textures.Count - 1;
        }
        public Texture2D GetTexture(int nID)
        {
            return textures[nID];
        }
        public int AddSpriteFont(SpriteFont sf)
        {
            spriteFonts.Add(sf);
            return spriteFonts.Count - 1;
        }
        public SpriteFont GetSpriteFont(int nID)
        {
            return spriteFonts[nID];
        }
        public void Dispose()
        {
            for (int i = 0; i < textures.Count; ++i)
                textures[i].Dispose();

            textures.Clear();
        }

        //////////////////////////////////////////////////////////////////////////
        // Properties
        public static Indie_Game_Contest.TextureManager Instance
        {
            get 
            {
                if (instance == null)
                    instance = new TextureManager();
                return instance; 
            }
        }
    }
}
